<?php


class desktop_mdl_lang extends dbeav_model{



    var $defaultOrder = array('app',' ASC',',lkey',' ASC');


    function dump($filter,$field = '*',$subSdf = null){

        $key = '';
        foreach($filter as $k=>$v){
            $key = $key .':'. $k.':'.$v;
        }


            if (!$filter || (is_array($filter) && count($filter) == 1 && !current($filter))) return null;
            //todo:ever need check
            if (!is_array($filter))
                $filter = array($this->idColumn => $filter);

            $field = explode(':', $field);
            $unfield = $field[1];
            $field = $field[0];

            $data = $this->db_dump($filter, $field);

            if (!$data) return null;

            $redata = $this->plain_to_sdf($data);
            if ($subSdf && !is_array($subSdf)) {
                $subSdf = $this->getSubSdf($subSdf);
            }
            if ($subSdf) {
                $this->_dump_depends($data, $subSdf, $redata);
            }
            $tCols = $this->_columns();
            if ($unfield) {
                foreach (explode(',', $unfield) as $k => $v) {
                    $v = trim($v);
                    if ($tCols[$v]) {
                        if ($tCols[$v]['sdfpath']) {
                            eval('unset( $redata["' . str_replace('/', '"]["', $tCols[$v]["sdfpath"]) . '"]);');
                        } else {
                            unset($redata[$v]);
                        }
                    }

                }
            }


            return $redata;

        }


}
